package io;

import java.io.*;

/**
 *
 *
 * 缓冲流是一对高级流，在流连接中的作用是提高读写效率
 */
public class CopyDemo3 {
    public static void main(String[] args) throws IOException {
        //指定文件
        FileInputStream fis = new FileInputStream("ppt.pptx");
        BufferedInputStream bis = new BufferedInputStream(fis,1024*10);
        //指定文件
        FileOutputStream fos = new FileOutputStream("ppt_cp2.pptx");
        BufferedOutputStream bos = new BufferedOutputStream(fos,1024*10);

        int d;
        long start = System.currentTimeMillis();
        while( (d = bis.read()) != -1 ) {//去读取
            bos.write(d);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕!耗时"+(end-start)+"ms");

        bis.close();
        bos.close();
    }
}


